#pragma once

#include "../Utilities/utilities.h"
#include "Defines.h"

#define KEY_W		(0x01 << 0)
#define KEY_S		(0x01 << 1)
#define KEY_A		(0x01 << 2)
#define KEY_D		(0x01 << 3)
#define KEY_UP		(0x01 << 4)
#define KEY_DOWN	(0x01 << 5)
#define KEY_LEFT	(0x01 << 6)
#define KEY_RIGHT	(0x01 << 7)
#define KEY_F		(0x01 << 8)

class CKeyManager
{
protected:
	static CKeyManager* ms_Instance;

	CKeyManager(void):m_iKeyDown(0), m_iKeyUp(0){}
	CKeyManager(const CKeyManager &){}
	CKeyManager& operator =(const CKeyManager &){}
	virtual ~CKeyManager(void){}

public:
	static CKeyManager* GetInstance()
	{
		if (ms_Instance == NULL)
			ms_Instance = new CKeyManager();
		return ms_Instance;
	}

	static void DestroyInstance()
	{
		SAFE_DEL(ms_Instance);
	}

	void Update(bool bIsKeyPress, unsigned char keyCode);
	void Clear();

	bool WasKeyDown(unsigned int key);
	int WasKeyUp(unsigned int key);
	bool WasAnyKeyDown();

	// Propertices
	int m_iKeyDown;
	int m_iKeyUp;
};
